package com.lemon.dubbo.controller;

import com.lemon.dubbo.service.IndexService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Reference(version = "1.0.0", url = "${dubbo.provider.indexService:${dubbo.provider.default:}}")
    private IndexService indexService;

    @GetMapping("hello/{name}")
    public String sayHello(@PathVariable String name) {
        return "HelloController sayHello === " + indexService.index(name);
    }

    @GetMapping("goodbye/{name}")
    public String sayGoodbye(@PathVariable String name) {
        return "HelloController sayGoodbye === " + indexService.index(name);
    }
}